package main

import (
	"fmt"
	"math"
)

type Person struct {
	Name string
	Age  int
}

func (p Person) SayHello() {
	fmt.Println("Hello myName", p.Name)
}

func main() {
	sum := add(3, 5)
	fmt.Println(sum)
	a, b := divide(3, 5)
	fmt.Println(a, b)
	result := square(2)
	fmt.Println(result)
	x := 120
	change(x)
	fmt.Println(x)

	p := Person{Name: "Bob", Age: 30}
	fmt.Println(p)
	printPerson(p)
	p.SayHello()

	fmt.Println(max(3, 6))

	book := Book{"三天", "伍佰"}
	fmt.Println(book)
	book.introduction()
}

func max(a, b int) int {
	return int(math.Max(float64(a), float64(b)))
}

func printPerson(p Person) {
	fmt.Println(p.Name)
	fmt.Println(p.Age)
}

func add(a int, b int) int {
	return a + b
}

func divide(a, b int) (int, int) {
	return a / b, a % b
}

func square(x int) (result int) {
	result *= x
	return
}

func change(x int) {
	x = 100
}
